package awesome.site.loader;

import java.io.File;

import awesome.ServerConfig;
import awesome.site.proprietor.SiteProprietor;

/**
 * Initializes the thread and executor service, provides a control interface.
 * 
 * @author Chris Carpenter
 * 
 */
public class Synchronizer {
	
	private SyncThread syncThread;
	private SyncExecutorService executor;
	
	public Synchronizer(SiteProprietor siteProprietor, String rootDirectory) {
		syncThread = new SyncThread(siteProprietor, new File(rootDirectory));
		executor = new SyncExecutorService(
				Integer.parseInt(ServerConfig.INSTANCE.getProperty("server.syncdelay")), 
				syncThread);
	}
	
	public void startSynchronization() {
		executor.startExecutor();
	}
	
	public void stopSynchronization() {
		executor.stopExecutor();
	}
}
